var sign = {
    // 同意签署弹窗
    fn_layer_agree: function() {
        $(document).on('click', '.bt-agree', function() {
            layer.open({
                type: 1 //Page层类型
                    ,
                area: ['420px', '260px'],
                title: '',
                closeBtn: 0, //不显示关闭按钮

                // btn: ['重要','奇葩'],
                shade: 0.6 //遮罩透明度
                    ,
                maxmin: false //允许全屏最小化
                    ,
                anim: 1 //0-6的动画形式，-1不开启
                    ,
                content: $('.layer-agree')
            });
        })

    },
    // 拒绝签署弹窗
    fn_layer_refuse: function() {
        $(document).on('click', '.bt-refuse', function() {
            layer.open({
                type: 1 //Page层类型
                    ,
                area: ['420px', '260px'],
                title: '',
                closeBtn: 0, //不显示关闭按钮

                // btn: ['重要','奇葩'],
                shade: 0.6 //遮罩透明度
                    ,
                maxmin: false //允许全屏最小化
                    ,
                anim: 1 //0-6的动画形式，-1不开启
                    ,
                content: $('.layer-refuse')
            });
        })
    },
    // 确认取消关闭弹窗
    fn_layer_close: function() {
        $(document).on('click', '.layer-button button', function() {
            layer.closeAll();

        })
        $(document).on('click', '.layer-agree .layer-button .bt-sure', function() {

            layer.msg('签署成功', {
                skin: 'layer-th' //自定义类名
                    ,
                time: '3000',

            }, function() {
                $('.file').hide()
                $('.file-success,.icon-infor-sign-success').removeClass('none');


            })

        })
    },

    // 点击底部调到相应图片块
    fn_bottom: function() {
        $(document).on('click', '.bottom li', function() {
            var index = $(this).index();
            $('body,html').animate({ scrollTop: 0 }, 0);
            $('.slick').slick('slickGoTo', index);
        })
        $('.slick').on('beforeChange', function(event, slick, currentSlide, nextSlide) {
            $('.bottom li').removeClass('active').eq(nextSlide).addClass('active')

        });
    },
    // 返回顶部
    fn_toptop: function() {
        $(document).on('click', '.totop', function() {
            $('body,html').animate({ scrollTop: 0 }, 500);
        })
    },
    // 控制滚动标题置顶、轮播图箭头位置以及签署成功logo位置
    fn_file_wrap: function() {
        var that = this;
        var top;
        $(window).scroll(function() {
            top = $(window).scrollTop();
            if (top >= 56) {
                $('.file-wrap').addClass('scroll')
                $('.icon-infor-sign-success').addClass('scroll')
                that.fn_loaction()
            } else {
                that.fn_loaction()
                $('.file-wrap').removeClass('scroll')
                $('.icon-infor-sign-success').removeClass('scroll')
                $('.file-wrap .file,.file-wrap .file-success').css('width', '1200px')
            
            }

        })

    },
    //控制页面窗口区域变化时候标题位置
    fn_loaction: function() {
        var _top = $(window).scrollTop();
        var left = 144 - $(window).scrollLeft();
        var width = document.documentElement.clientWidth || document.body.clientWidth;
        var _width = width - 50
        if (width <= 1300 && _top >= 56) {
            $('.file-wrap .file,.file-wrap .file-success').addClass('resize').css('width', _width)
            $('.icon-infor-sign-success').css({
                'left': left,
                'marginLeft': '-30px'
            })

        } else {
            $('.file-wrap .file,.file-wrap .file-success').removeClass('resize').css('width', '1200px')
            $('.icon-infor-sign-success').css({
                'left': 'auto',
                'marginLeft': '-35px'
            })
        }
    },
    fn_resize: function() {
        $(window).resize(function() {
            sign.fn_loaction();
        })
    },
    init: function() {
        this.fn_layer_agree();
        this.fn_layer_refuse();
        this.fn_layer_close();
        this.fn_bottom();
        this.fn_toptop();
        this.fn_file_wrap();
        this.fn_loaction();
        this.fn_resize();
    }
}
$(function() {
    sign.init();
})